<?php
//连接数据库查询出分类相关的数据，返回给前端即可
//1.连接数据库
require_once "../../config.php";
require_once "../../functions.php";
//2.sql语句
$connect = connect();
//3.执行查询
$sql = "select * from categories;";
//4.把数据返回给前端
$queryResult = query($connect,$sql);
$response = ["code"=>0,"msg"=>"操作失败"];
if($queryResult){
    $response["code"] = 1;
    $response["msg"] = "操作成功";
    $response["data"] = $queryResult;
}
header("content-type:application/json;charset=utf8");
echo json_encode($response);
?>